// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import Client from '@api/map/api/AreaMapApi'

import AddClass from '@api/map/model/BindAreaMapReq'
import BaseClass from '@api/map/model/AreaMapDto'

const EditClass = AddClass

const CLIENT = CORE.grpcCLIENT(Client)
const BASE = [BaseClass, 'content']

// ============================== 导出远程接口 ============================== //

export default {
  // —————————————————————————————— 增 —————————————————————————————— //

  async add(param, TIP = '新增') {
    const DTO = CORE.grpcDTO(AddClass, param, BASE)
    await CORE.grpc(TIP, CLIENT, 'bindAreaMap', DTO)
    return CORE.grpcOK(TIP)
  },

  // —————————————————————————————— 改 —————————————————————————————— //

  async edit(param, TIP = '修改') {
    const DTO = CORE.grpcDTO(EditClass, param, BASE)
    await CORE.grpc(TIP, CLIENT, 'bindAreaMap', DTO)
    return CORE.grpcOK(TIP)
  },
}
